//
//  MineMessageViewController.m
//  SameWorld(merchant)
//
//  Created by 李小朋 on 2017/4/1.
//  Copyright © 2017年 杨旭. All rights reserved.
//

#import "MineMessageViewController.h"
#import "MineMessageCell.h"
@interface MineMessageViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic ,strong) UITableView *tableView;
@property (nonatomic ,strong) NSArray *titleArr;
@property (nonatomic ,strong) NSArray *imageArr;
@end

@implementation MineMessageViewController

-(NSArray *)titleArr {
    
    if (!_titleArr) {
        _titleArr = @[@"订单通知",@"退款通知",@"评价消息"];
    }
    return _titleArr;
}

-(NSArray *)imageArr {
    if (!_imageArr) {
        _imageArr = @[@"ic_dingdan",@"ic_tuikuan",@"ic_pingjia"];
    }
    return _imageArr;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"我的消息";
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"ic_shezhi"] style:(UIBarButtonItemStylePlain) target:self action:@selector(rightItem:)];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    [self createTableViewUI];
}

- (void)rightItem:(UIBarButtonItem *)sender {
    
    NSLog(@"设置");
}

- (void)createTableViewUI {

    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:(UITableViewStylePlain)];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.backgroundColor = [UIColor colorWithHexString:@"#f2f2f2"];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];


}

#pragma mark - UITableView的代理方法
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.titleArr.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    MineMessageCell *cell = [MineMessageCell cellWithTableView:tableView];
    cell.titleLabel.text = self.titleArr[indexPath.row];
    cell.image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",self.imageArr[indexPath.row]]];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 69;
}

@end
